package ie.dpsystems.errorlog;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

public class ErrorDetailsActivity extends Activity implements IErrorDetailsView {
	
	private ErrorDetailsController _controller;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_error_details);
	
		
		Bundle extras = getIntent().getExtras();
		int value = extras.getInt("errorUniqueId");

		_controller =  new ErrorDetailsController(this);
		_controller.GetErrorDetails(value);
	}

	@Override
	public void SetErrorDetails(ErrorDetails error) {
		// TODO Auto-generated method stub

		TextView name = (TextView)findViewById(R.id.errorName);
		TextView callStack = (TextView)findViewById(R.id.errorStack);
		TextView winUser = (TextView)findViewById(R.id.errorWindowsUser);
		TextView logDate = (TextView)findViewById(R.id.errorLogDate);
		Button showScreenBtn = (Button)findViewById(R.id.showErrorScreenShotBtn);
		
		name.setText(error._name);
		callStack.setText(error._initialCallStack);
		winUser.setText(error._windowsUserName);
		logDate.setText(error._logDate.toString());
		showScreenBtn.setEnabled(error._hasScreenShot);
	}
}
